import { request } from "@/utils/request";
import Qs from "qs";

// 查询商品审核列表
export function getHmProductsAuditList(data) {
  return request({
    url: "/basic/pricing/getList",
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  });
}
// 品控部查询商品审核列表
export function getQualityList(data) {
  return request({
    url: "/basic/quality/getList",
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: Qs.stringify(data),
  });
}
/**
 * app/pc待核价查看详情
 * @param query
 * @returns
 */
export function getPricingId(data: { id: any }) {
  return request({
    url: '/basic/pricing/id',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
}

/**
 * app/品控查看详情
 * @param query
 * @returns
 */
export function getQualityId(data: { id: any }) {
  return request({
    url: '/basic/quality/id',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    method: 'post',
    data: Qs.stringify(data)
  });
}

// 招商部查询商品审核列表
export function getPromotionList(query) {
  return request({
    url: "/basic/pricing/promotionList",
    method: "post",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    data: query,
  });
}
// app 招商端 查看已选品
export function getSelectedProduct(data) {
  return request({
    url: "/basic/selection/getSelectedProduct",
    method: "post",
    data
  });
}
// app 招商端 查看已选品详情
export function getSelectedById(data) {
  return request({
    url: "/basic/selection/getSelectedById",
    method: "post",
    data
  });
}
// 已选品批量送审
export function batchQuantity(data) {
  return request({
    url: "/basic/selection/batchQuantity",
    method: "post",
    data
  });
}

/**
 * 审核成功
 * @param data
 */
export const pass = (data: { auditDept: number; id: string; productsId: string }) => {
  return request({
    url: '/basic/pricing/pass',
    method: 'post',
    data: data
  });
};

/**
 * 审核失败
 * @param data
 */
export const refuse = (data: { auditDept: number; id: string; productsId: string; auditRemark: string }) => {
  return request({
    url: '/basic/pricing/refuse',
    method: 'post',
    data: data
  });
};


/**
 * app品控审核失败
 * @param data
 */
export const qualityRefuse = (data: { auditDept: number; id: string; productsId: string; auditRemark: string }) => {
  return request({
    url: '/basic/quality/refuse',
    method: 'post',
    data: data
  });
};

/**
 * app 品控审核成功
 * @param data
 */
export const qualityPass = (data: { auditDept: number; id: string; productsId: string }) => {
  return request({
    url: '/basic/quality/pass',
    method: 'post',
    data: data
  });
};



// 获取部门列表
export function getSystemList(query) {
  return request({
    url: "/system/dept/queryList",
    method: "get",
    params: query,
  });
}
/** 获取部门列表和用户列表 */
export function getDeptAndUserTreeList(query) {
  return request({
    url: "/system/dept/getDeptAndUserTreeList",
    method: "get",
    params: query,
  });
}

// 查询商品审核列表的三种状态
export function getStatus(data) {
  return request({
    url: "/basic/pricing/getStatus",
    method: "post",
    data: data,
  });
}

// app商品品控审核列表待处理 已通过 已驳回 的三种状态
export function getQualityStatus(data) {
  return request({
    url: "/basic/quality/getStatus",
    method: "post",
    data: data,
  });
}

// 研发-已选品-批量送审
export const requestThirdInvent = (data: any) => {
  return request({
    url: '/basic/selection/requestThirdInvent',
    method: 'post',
    data
  });
};

